<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <title>添加设备</title>
    <!-- <link rel="stylesheet" href="__CSS__/bootstrap.min.css"> -->
    <!-- <link rel="stylesheet" href="__CSS__/hdw.css"> -->
    <link rel="stylesheet" type="text/css" href="__CSS__/reset.css">
    <link rel="stylesheet" type="text/css" href="__CSS__/wechat/adds.css">
    <script src="__JS__/libs/jquery-2.0.2.min.js"></script>
    <script type="text/javascript" src="__JS__/swayPlugIn.js"></script>
    <!-- <script src="__JS__/bootstrap/bootstrap.min.js"></script> -->
</head>
<body>

<div id="contentBox">
    <div class="row row1">
        <div class="col-sm-12 col-xs-12">
            <form id="form1" method="post" action="{{:url('Cons/adds')}}" enctype="multipart/form-data">
                <div class="one">
                    <label for="username">提交人</label>
                    <input type="text" value="{{$uname}}" readonly />
                </div>
                <div class="one">
                    <label for="username">设备名称</label>
                    <input type="text" id="dev_name" name='name' placeholder="设备名称" autocomplete="off"/>
                </div>
                <div class="one">
                    <label for="passwowd">设备编号</label>
                    <input type="text" id="dcode" name="devcode" value="" readonly />
                </div>
                <div class="one">
                    <label for="passwowd">添加时间</label>
                    <input type="text" value="<php>echo date('Y-m-d H:i:s');</php>" readonly />
                </div>
                <div class="one">
                    <label for="passwords">所在地</label>
                    <input type="text" id="d_address" name='address' placeholder="设备详细地址" autocomplete="off"/>
                </div>
                <div class="two">
                    <button type="button" id="send"/>提交</button>
                </div>
            </form>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(function(){
        $("#send").click(function(){
            for(var i = 0; i < $(".one input").length; i++){
                var val = $(".one input").eq(i).val();
                var name = $(".one input").eq(i).attr("name");
                if(val == ""){
                    if(name == "name"){
                        swayPlugs.msg("设备名称不能为空！",1500);
                        return;
                    }else if(name == "address"){
                        swayPlugs.msg("设备详细地址不能为空！",1500);
                        return;
                    }
                };
            }
            $("#form1").submit();
        })
    })
</script>
</body>
</html>